HAL CORDIC control functions migration ¶
This section provides information about the HAL CORDIC control functions migration.
Note
The main difference between HAL1 and HAL2 calculation APIs is the introduction of a dedicated hal_cordic_buffer_desc_t type, allowing the provision of both the buffer pointer and its size.
HAL CORDIC variable declaration and buffer initialization ¶
|
HAL1 |
HAL2 |
|---|---|
int32_t input_data[4] = {0x80000000, 0x90000000, 0xA0000000, 0xB0000000};
int32_t output_data[4] = {0U};
uint32_t NbCalc = 4;
uint32_t timeout_ms = 10;
|
int32_t input_data[4] = {0x80000000, 0x90000000, 0xA0000000, 0xB0000000};
int32_t output_data[4] = {0U};
hal_cordic_buffer_desc_t input_buffer = {
.p_data = input_data,
.size_word = 4};
hal_cordic_buffer_desc_t output_buffer = {
.p_data = output_data,
.size_word = 4};
uint32_t timeout_ms = 10;
|
HAL CORDIC calculation in polling mode. ¶
For variable declaration and buffer initialization in HAL1 and HAL2, please refer to the HAL CORDIC variable declaration and buffer initialization.
|
HAL1 |
HAL2 |
|---|---|
HAL_CORDIC_Calculate(&hcordic,
input_data,
output_data,
NbCalc,
timeout_ms)
|
HAL_CORDIC_Calculate(&hcordic,
&input_buffer,
&output_buffer,
timeout_ms)
|
HAL CORDIC calculation in zero-overhead mode. ¶
For variable declaration and buffer initialization in HAL1 and HAL2, please refer to the HAL CORDIC variable declaration and buffer initialization.
|
HAL1 |
HAL2 |
|---|---|
HAL_CORDIC_CalculateZO(&hcordic,
input_data,
output_data,
NbCalc,
timeout_ms)
|
HAL_CORDIC_CalculateZeroOverhead(&hcordic,
&input_buffer,
&output_buffer,
timeout_ms)
|
HAL CORDIC calculation in interrupt mode. ¶
For variable declaration and buffer initialization in HAL1 and HAL2, please refer to the HAL CORDIC variable declaration and buffer initialization.
|
HAL1 |
HAL2 |
|---|---|
HAL_CORDIC_Calculate_IT(&hcordic,
input_data,
output_data,
NbCalc)
|
HAL_CORDIC_Calculate_IT(&hcordic,
&input_buffer,
&output_buffer)
|
HAL CORDIC calculation in DMA mode. ¶
In HAL1, HAL_CORDIC_Calculate_DMA with DMADirection set to
CORDIC_DMA_DIR_INorCORDIC_DMA_DIR_OUTmanages a single DMA stream, relying on other peripherals (ADC) for the complementary stream.HAL2 introduces separate APIs
HAL_CORDIC_Write_DMAandHAL_CORDIC_Read_DMAto independently handle input and output DMA transfers. For more details see layout.
For variable declaration and buffer initialization in HAL1 and HAL2, please refer to the HAL CORDIC variable declaration and buffer initialization.
|
HAL1 |
HAL2 |
|---|---|
HAL_CORDIC_Calculate_DMA(&hcordic,
input_data,
output_data,
NbCalc,
CORDIC_DMA_DIR_IN_OUT) /* DMADirection = CORDIC_DMA_DIR_IN_OUT
to enable CORDIC to handle both input and output streams*/
|
HAL_CORDIC_Calculate_DMA(&hcordic,
&input_buffer,
&output_buffer)
|
HAL_CORDIC_Calculate_DMA(&hcordic,
input_data,
NULL, /* pOutBuff = NULL */
NbCalc,
CORDIC_DMA_DIR_IN) /* DMADirection = CORDIC_DMA_DIR_IN
to enable CORDIC to manage the input DMA stream only */
|
HAL_CORDIC_Write_DMA(&hcordic,
&input_buffer)
|
HAL_CORDIC_Calculate_DMA(&hcordic,
NULL, /* pInBuff = NULL */
output_data,
NbCalc,
CORDIC_DMA_DIR_OUT) /* DMADirection = CORDIC_DMA_DIR_OUT
to enable CORDIC to manage the output DMA stream only */
|
HAL_CORDIC_Read_DMA(&hcordic,
&output_buffer)
|
HAL CORDIC configures the peripheral parameters. ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CORDIC_Configure(CORDIC_HandleTypeDef *hcordic,
const CORDIC_ConfigTypeDef *sConfig)
|
HAL_CORDIC_SetConfig(hal_cordic_handle_t *hcordic,
const hal_cordic_config_t *p_config)
|